<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>优田儿童成长中心</title>
    <!-- Styles -->
    <link href="/static/assets/fontAwesome/css/fontawesome-all.min.css" rel="stylesheet">
    <link href="/static/assets/css/lib/themify-icons.css" rel="stylesheet">
    <link href="/static/assets/css/lib/mmc-chat.css" rel="stylesheet"/>
    <link href="/static/assets/css/lib/sidebar.css" rel="stylesheet">
    <link href="/static/assets/css/lib/bootstrap.min.css" rel="stylesheet">
    <link href="/static/assets/css/lib/nixon.css" rel="stylesheet">
    <link href="/static/assets/lib/lobipanel/css/lobipanel.min.css" rel="stylesheet">
    <link href="/static/assets/css/style.css" rel="stylesheet">
    <script src="/static/js/jquery-1.11.0.js"></script>
</head>

<body>
<div class="sidebar sidebar-hide-to-small sidebar-shrink sidebar-gestures">
    <div class="nano">
        <div class="nano-content">
            <ul>
                <li>
                    <a href="/home/"><i class="ti-bar-chart"></i> 统计数据</a>
                </li>
                <li>
                    <a href="/teacher/"><i class="ti-user"></i> 教师管理</a>
                </li>
                <li class="active">
                    <a href="/child/"><i class="ti-user"></i> 幼儿管理<span
                            class="sidebar-collapse-icon ti-angle-right"></span></a>
                </li>
                <li>
                    <a href="/posts/"><i class="ti-desktop"></i> 岗位管理</a>
                </li>
            </ul>
        </div>
    </div>
</div>
<!-- /# sidebar -->
<div class="header">
    <div class="pull-left">
        <div class="logo">
            <a>
                <img id="logoImg" src="/static/img/yt1.png" data-logo_big="/static/img/yt1.png"
                     data-logo_small="/static/img/yt3.png" alt="Nixon"/>
            </a>
        </div>
        <div class="hamburger sidebar-toggle">
            <span class="ti-menu"></span>
        </div>
    </div>
    <div class="pull-right p-r-15">
        <ul>
            <li class="header-icon dib">
                <img class="avatar-img" src="/static/assets/images/avatar/1.jpg" alt=""/> <span
                    class="user-avatar"><span th:text="${session.username}"></span>&nbsp;&nbsp;&nbsp;<i
                    class="ti-angle-down f-s-10"></i></span>
                <div class="drop-down dropdown-profile">
                    <div class="dropdown-content-body">
                        <ul>
                            <li><a href="/exit/"><i class="ti-power-off"></i> <span>注销</span></a></li>
                        </ul>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</div>
<div class="chat-sidebar">
    <!-- BEGIN chat -->
    <div id="mmc-chat" class="color-default">
        <!-- BEGIN CHAT BOX -->
        <div class="chat-box">
            <!-- BEGIN CHAT BOXS -->
            <ul class="boxs"></ul>
            <!-- END CHAT BOXS -->
            <div class="icons-set">
                <div class="stickers">
                    <div class="had-container">
                        <div class="row">
                            <div class="s12">
                                <ul class="tabs" style="width: 100%;height: 60px;">
                                    <li class="tab col s3">
                                        <a href="#tab1" class="active">
                                            <img src="assets/images/1.png" alt=""/>
                                        </a>
                                    </li>
                                    <li class="tab col s3"><a href="#tab2">Test 2</a></li>
                                </ul>
                            </div>
                            <div id="tab1" class="s12 tab-content">
                                <ul>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                    <li><img src="assets/images/1.png" alt=""/></li>
                                </ul>
                            </div>
                            <div id="tab2" class="s12 tab-content">Test 2</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- END CHAT BOX -->
        <!-- BEGIN SIDEBAR -->
        <div id="sidebar" class="right scroll">
            <div class="had-container">
                <!-- BEGIN USERS -->
                <div class="users">
                    <ul class="user-list">
                        <!-- BEGIN USER-->
                        <li class="user-tooltip" data-id="1" data-status="online" data-username="Rufat Askerov"
                            data-position="left" data-filter-item data-filter-name="rufat askerov">
                            <!-- BEGIN USER IMAGE-->
                            <div class="user-image">
                                <img src="assets/images/avatar/1.jpg" class="avatar" alt="Rufat Askerov"/>
                            </div>
                            <!-- END USER IMAGE-->
                            <!-- BEGIN USERNAME-->
                            <span class="user-name">Rufat Askerov</span>
                            <span class="user-show"></span>
                            <!-- END USERNAME-->
                        </li>
                        <!-- END USER-->
                        <!-- BEGIN USER-->
                        <li class="user-tooltip" data-id="3" data-status="online" data-username="Alice"
                            data-position="left" data-filter-item data-filter-name="alice">
                            <div class="user-image">
                                <img src="assets/images/avatar/1.jpg" class="avatar" alt="Alice"/>
                            </div>
                            <span class="user-name">Alice</span>
                            <span class="user-show"></span>
                        </li>
                        <!-- BEGIN USER-->
                        <li class="user-tooltip" data-id="7" data-status="offline" data-username="Michael Scofield"
                            data-position="left" data-filter-item data-filter-name="michael scofield">
                            <div class="user-image">
                                <img src="assets/images/avatar/1.jpg" class="avatar" alt="Michael Scofield"/>
                            </div>
                            <span class="user-name">Michael Scofield</span>
                            <span class="user-show"></span>
                        </li>
                        <!-- BEGIN USER-->
                        <li class="user-tooltip" data-id="5" data-status="online" data-username="Irina Shayk"
                            data-position="left" data-filter-item data-filter-name="irina shayk">
                            <div class="user-image">
                                <img src="assets/images/avatar/1.jpg" class="avatar" alt="Irina Shayk"/>
                            </div>
                            <span class="user-name">Irina Shayk</span>
                            <span class="user-show"></span>
                        </li>
                        <!-- BEGIN USER-->
                        <li class="user-tooltip" data-id="6" data-status="offline" data-username="Sara Tancredi"
                            data-position="left" data-filter-item data-filter-name="sara tancredi">
                            <div class="user-image">
                                <img src="assets/images/avatar/1.jpg" class="avatar" alt="Sara Tancredi"/>
                            </div>
                            <span class="user-name">Sara Tancredi</span>
                            <span class="user-show"></span>
                        </li>
                        <!-- BEGIN USER-->
                        <li class="user-tooltip" data-id="7" data-status="offline" data-username="Jane"
                            data-position="left" data-filter-item data-filter-name="Jane">
                            <div class="user-image">
                                <img src="assets/images/avatar/1.jpg" class="avatar" alt="Jane"/>
                            </div>
                            <span class="user-name">Jane</span>
                            <span class="user-show"></span>
                        </li>
                    </ul>
                    <div class="chat-user-search">
                        <div class="input-group">
                            <span class="input-group-addon"><i class="ti-search"></i></span>
                            <input type="text" class="form-control" placeholder="Search" data-search/>
                        </div>
                    </div>
                </div>
                <!-- END USERS -->
            </div>
        </div>
        <!-- END SIDEBAR -->
    </div>
    <!-- END chat -->
</div>
<!-- END chat Sidebar-->
<div class="content-wrap">
    <div class="main">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-8 p-0">
                    <div class="page-header">
                        <div class="page-title">
                            <h1>幼儿管理</h1>
                        </div>
                    </div>
                </div>
                <!-- /# column -->
                <div class="col-lg-4 p-0">
                    <div class="page-header">
                        <div class="page-title">
                            <ol class="breadcrumb text-right">
                                <li><a th:href="@{/update_child/(cid=${c.cid})}">编辑幼儿</a></li>
                                <li class="active">幼儿管理</li>
                            </ol>
                        </div>
                    </div>
                </div>
                <!-- /# column -->
            </div>
            <!-- /# row -->
            <div class="main-content">
                <div class="row">
                    <div class="card alert">
                        <div class="card-header">
                            <h4>编辑幼儿</h4>
                            <div class="card-header-right-icon">
                                <!--<ul>
                                    <li class="card-close" data-dismiss="alert"><i class="ti-close"></i></li>
                                </ul>-->
                            </div>
                        </div>
                        <div class="card-body">
                            <div class="basic-elements">
                                <form id="updateChildForm">
                                    <input type="hidden" name="cid" th:value="${c.cid}"/>

                                    <div class="form-group">
                                        <label>姓名</label>
                                        <input type="text" class="form-control" name="cname" placeholder="请输入幼儿姓名"
                                               th:value="${c.cname}" required>
                                    </div>

                                    <div class="form-group">
                                        <label>性别</label>
                                        <select class="form-control" name="csex" required>
                                            <option value="男" th:selected="${c.csex == '男'}">男</option>
                                            <option value="女" th:selected="${c.csex == '女'}">女</option>
                                        </select>
                                    </div>

                                    <div class="form-group">
                                        <label>年龄</label>
                                        <input type="text" class="form-control" name="cage" placeholder="请输入幼儿年龄"
                                               th:value="${c.cage}" required>
                                    </div>

                                    <div class="form-group">
                                        <label>家长</label>
                                        <input type="text" class="form-control" name="cparnt" placeholder="请输入家长姓名"
                                               th:value="${c.cparnt}" required>
                                    </div>

                                    <div class="form-group">
                                        <label>联系方式</label>
                                        <input type="text" class="form-control" name="ctel" placeholder="请输入联系方式"
                                               th:value="${c.ctel}" required>
                                    </div>

                                    <div class="form-group">
                                        <button type="button" class="btn btn-success m-b-10 m-l-5" id="btnUpdate">确认修改</button>
                                        <a href="/child/" class="btn btn-warning m-b-10 m-l-5">返回</a>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /# main content -->Copyright &copy; 2024
        </div>
        <!-- /# container-fluid -->
    </div>
    <!-- /# main -->
</div>
<!-- /# content wrap -->
<script src="/static/assets/js/lib/jquery.min.js"></script>
<!-- jquery vendor -->
<script src="/static/assets/js/lib/jquery.nanoscroller.min.js"></script>
<!-- nano scroller -->
<script src="/static/assets/js/lib/sidebar.js"></script>
<!-- sidebar -->
<script src="/static/assets/js/lib/bootstrap.min.js"></script>
<!-- bootstrap -->
<script src="/static/assets/js/lib/mmc-common.js"></script>
<script src="/static/assets/js/lib/mmc-chat.js"></script>
<!--  Chart js -->
<script src="/static/assets/js/lib/chart-js/Chart.bundle.js"></script>
<script src="/static/assets/js/lib/chart-js/chartjs-init.js"></script>
<!-- // Chart js -->
<!--  Datamap -->
<script src="/static/assets/js/lib/datamap/d3.min.js"></script>
<script src="/static/assets/js/lib/datamap/topojson.js"></script>
<script src="/static/assets/js/lib/datamap/datamaps.world.min.js"></script>
<script src="/static/assets/js/lib/datamap/datamap-init.js"></script>
<script src="/static/assets/lib/lobipanel/js/lobipanel.js"></script>
<!-- // Datamap -->
<script src="/static/assets/js/scripts.js"></script>
<!-- scripit init-->
<script>
    $(document).ready(function () {
        $('#lobipanel-custom-control').lobiPanel({
            reload: false,
            close: false,
            editTitle: false
        });
    });
</script>
<script>
    $('#btnUpdate').click(function () {
        const formData = {
            cid: $('input[name="cid"]').val(),
            cname: $('input[name="cname"]').val(),
            csex: $('select[name="csex"]').val(),
            cage: $('input[name="cage"]').val(),
            cparnt: $('input[name="cparnt"]').val(),
            ctel: $('input[name="ctel"]').val()
        };

        $.ajax({
            url: '/api/v1/manager/child/update',
            type: 'POST',
            contentType: 'application/json',
            data: JSON.stringify(formData),
            success: function (res) {
                if (res.code === 200) {
                    alert('修改成功');
                    window.location.href = '/child/';
                } else {
                    alert('修改失败：' + res.message);
                }
            },
            error: function () {
                alert('请求失败，请稍后重试');
            }
        });
    });
</script>
<style>
    .copyrights {
        text-indent: -9999px;
        height: 0;
        line-height: 0;
        font-size: 0;
        overflow: hidden;
    }
</style>
<div class="copyrights">
    <h3>&copy; 版权所有 | </h3>
</div>
</body>

</html>